{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import requests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cookie2=a26a7fb2a662fc36fcf8ed115d085e12;_tb_token_=7JuC1oka56bq;t=65c5c83258672fac0e69eb4f11a96595;v=0;cookie32=952c9fd643ed13cea5c39990efc48139;cookie31=Njg4NjkyNDAsbWVpbHl4aWFvLDI5MzM0Mjc2QHFxLmNvbSxUQg%3D%3D;alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D;login=VT5L2FSpMGV7TQ%3D%3D;alimamapw=DFwKDxwcUQQOOAVTU1FTBwQHUVtWVFxWWwNRUgZRBFYHVwQBBw1SBwAG;cna=dICQEdpHCHQCAW5WR3cFnhx1\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<RequestsCookieJar[Cookie(version=0, name='JSESSIONID', value='668B593DA76304677D40D9E36FA88545', port=None, port_specified=False, domain='m.taobao.com', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={'HttpOnly': None}, rfc2109=False)]>"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "import urllib2\n",
    "url = 'https://m.taobao.com/#index'\n",
    "cookie_str = 'cookie2@@@a26a7fb2a662fc36fcf8ed115d085e12;_tb_token_@@@7JuC1oka56bq;t@@@65c5c83258672fac0e69eb4f11a96595;v@@@0;cookie32@@@952c9fd643ed13cea5c39990efc48139;cookie31@@@Njg4NjkyNDAsbWVpbHl4aWFvLDI5MzM0Mjc2QHFxLmNvbSxUQg%3D%3D;alimamapwag@@@TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQ7IHJ2OjUzLjApIEdlY2tvLzIwMTAwMTAxIEZpcmVmb3gvNTMuMA%3D%3D;login@@@VT5L2FSpMGV7TQ%3D%3D;alimamapw@@@DFwKDxwcUQQOOAVTU1FTBwQHUVtWVFxWWwNRUgZRBFYHVwQBBw1SBwAG;cna@@@dICQEdpHCHQCAW5WR3cFnhx1'\n",
    "cookie_str = cookie_str.replace('@@@','=')\n",
    "print cookie_str\n",
    "headers = {'Cookie':cookie_str}\n",
    "r = requests.post(url,headers=headers)\n",
    "cookies = r.cookies\n",
    "cookies\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "u' mtopjsonp2({\"api\":\"mtop.taobao.couponmtopreadservice.findshopbonusactivitys\",\"v\":\"2.0\",\"ret\":[\"FAIL_SYS_SESSION_EXPIRED::SESSION\\u5931\\u6548\"],\"data\":{}})'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'utf-8'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "url = 'http://admin.zhuandanku.com/api.php/listtransfer/Tngoodsinfo/onSaleGoodsCouponLink'\n",
    "response = requests.get(url)\n",
    "dir(response)\n",
    "response.encoding"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "str1 = 'cookie2=0cae676e099c52bec21829f8e3e1f044; t=9d321755ce521c2e5ace0c0fef25275f; v=0; _tb_token_=1IZjIO3r8aq; cookie32=952c9fd643ed13cea5c39990efc48139; cookie31=Njg4NjkyNDAsbWVpbHl4aWFvLDI5MzM0Mjc2QHFxLmNvbSxUQg%3D%3D; alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV09XNjQpIEFwcGxlV2ViS2l0LzUzNy4zNiAoS0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS81OC4wLjMwMjkuODEgU2FmYXJpLzUzNy4zNg%3D%3D; login=U%2BGCWk%2F75gdr5Q%3D%3D; alimamapw=D1UMX0tJWQVWaFRRVgAFUg5RUlJQBAsDUwIJAldTAQdRAg5XBARUV1dT; cna=PJuIESZDB3ACAXgqYLR8nSPm; rurl=aHR0cDovL3B1Yi5hbGltYW1hLmNvbS8%2Fc3BtPWEyMzIwLjczODg3ODEuYTIxNHRyOC4xNS5FNTVyVnM%3D; l=Are3WwltpzlWGpOoO60atCdlx6ABfIve; isg=AoCAf2CqzUFMULFFYbfJzNG7UQ7FuGTT6kd67voRTBsudSCfohk0Y1ZH-2tO'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ConnectTimeout',\n",
       " 'ConnectionError',\n",
       " 'DependencyWarning',\n",
       " 'FileModeWarning',\n",
       " 'HTTPError',\n",
       " 'NullHandler',\n",
       " 'PreparedRequest',\n",
       " 'ReadTimeout',\n",
       " 'Request',\n",
       " 'RequestException',\n",
       " 'Response',\n",
       " 'Session',\n",
       " 'Timeout',\n",
       " 'TooManyRedirects',\n",
       " 'URLRequired',\n",
       " '__author__',\n",
       " '__build__',\n",
       " '__builtins__',\n",
       " '__copyright__',\n",
       " '__doc__',\n",
       " '__file__',\n",
       " '__license__',\n",
       " '__name__',\n",
       " '__package__',\n",
       " '__path__',\n",
       " '__title__',\n",
       " '__version__',\n",
       " 'adapters',\n",
       " 'api',\n",
       " 'auth',\n",
       " 'certs',\n",
       " 'codes',\n",
       " 'compat',\n",
       " 'cookies',\n",
       " 'delete',\n",
       " 'exceptions',\n",
       " 'get',\n",
       " 'head',\n",
       " 'hooks',\n",
       " 'logging',\n",
       " 'models',\n",
       " 'options',\n",
       " 'packages',\n",
       " 'patch',\n",
       " 'post',\n",
       " 'put',\n",
       " 'request',\n",
       " 'session',\n",
       " 'sessions',\n",
       " 'status_codes',\n",
       " 'structures',\n",
       " 'utils',\n",
       " 'warnings']"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "dir(requests)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
